<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "edu_report".
 *
 * @property int $id
 * @property string $title 举报的对象的标题
 * @property int $style 被举报的类型1视频2问答
 * @property int $obj_id 被举报对象的id
 * @property int $user_id 举报者id
 * @property string $reason 举报原因
 * @property int $create_time
 * @property int $status -1未处理1已处理
 */
class EduReport extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'edu_report';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['style', 'obj_id', 'user_id', 'create_time', 'status'], 'integer'],
            [['create_time'], 'required'],
            [['title', 'reason'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'title' => '标题',
            'style' => 'Style',
            'obj_id' => 'Obj ID',
            'user_id' => '用户ID',
            'reason' => '原因',
            'create_time' => '时间',
            'status' => '是否处理',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     * 关联edu_user表
     */
    public function getUser()
    {
        return $this->hasOne(EduUser::class, ['id' => 'user_id']);
    }
}
